<template>
  <div class="hellohui">
    <el-table
      :data="tableData"
      border
      style="width: 100%">
      <el-table-column
        prop="name"
        label="姓名"
        width="180">
      </el-table-column>
      <el-table-column
        prop="phone"
        label="苹果手机号">
      </el-table-column>
      <el-table-column
        prop="email"
        label="邮箱">
      </el-table-column>
      <el-table-column
        prop="address"
        label="地址">
      </el-table-column>
      <el-table-column
        prop="createTime"
        label="创建日期">
      </el-table-column>
    </el-table>
    <!--分页-->
    <el-pagination
      @size-change="handleSizeChange"
      @current-change="handleCurrentChange"
      :current-page.sync="currentPage"
      :page-sizes="[5, 10, 15, 20]"
      :page-size="pageSize"
      layout="sizes, prev, pager, next"
      :total="0">
    </el-pagination>
  </div>
</template>

<script>
export default {
  methods: {
    handleSizeChange(val) {
      console.log(`每页 ${val} 条`);
      this.pageSize=val;
      this.list();
    },
    handleCurrentChange(val) {
      this.currentPage=val;
      console.log(`当前页: ${val}`);
      this.list();
    },
    list(){
      this.$http.post("/user/list",{"currentPage":this.currentPage,"pageSize":this.pageSize})
        .then(Result=>{
          this.tableData=Result.data.rows;
          console.log(Result+"啦啦啦啦啦啦啊")
          this.totals=Result.data.totals})
        .catch(Result=>{
        })

    }

  },
  data() {
    return {
      tableData: [],
      totals:0,
      pageSize:6,
      currentPage:1,
    }
  },
  mounted() {
    this.list();
  }


}

</script>




<!-- Add "scoped" attribute to limit CSS to this component only -->
<style >

</style>
